import React from 'react';

import { connect } from 'umi';

// import { Row, Col } from 'antd';

import styles from './styles.less';

// import InternationaliZation from './components/InternationaliZation'; //国际化切换
import Message from './components/Message'; //国际化切换

import HeaderLayout from './components/HeaderLayout'; //头部hover Ui

import PersonalSettings from './components/PersonalSettings'; //头部hover Ui

// import Workbench from './components/Workbench'; //我的工作台

import { GlobalHeaderContext } from './GlobalHeaderStore';

import { HeaderAPI } from '@/components/GlobalHeader/type';

const index: React.FC<HeaderAPI.HeaderProps> = ({
  BasicLayoutProps,
  switchingPos,
  positionList,
  allUserInfo,
  dispatch,
  setLayoutSettings,
  settings,
  permissions,
  baseLogin,
}) => {
  return (
    <GlobalHeaderContext.Provider
      value={{
        positionList, //岗位信息数据
        allUserInfo, //所有的个人信息
        switchingPos, //切换岗位方法
        BasicLayoutProps,
        dispatch,
        setLayoutSettings,
        settings,
        permissions,
        baseLogin,
      }}
    >
      <div className={styles['global-header']} style={{ height: BasicLayoutProps?.headerHeight ?? '100%' }}>
        {/* 右侧个人数据设置 */}
        <HeaderLayout>
          <PersonalSettings />
        </HeaderLayout>

        {/*/!* 国际化下拉框 *!/*/}
        {/* <HeaderLayout>
         <InternationaliZation/>
        </HeaderLayout> */}

        {/*/!* 超期提醒 *!/*/}
        {baseLogin?.permissions?.['/contractController/handleHomePage'] && (
          <HeaderLayout>
            <Message curRes={baseLogin?.permissions} msgType={'0'} />
          </HeaderLayout>
        )}

        {/*/!* 消息通知 *!/*/}
        {baseLogin?.permissions?.['/contractController/notifyHomePage'] && (
          <HeaderLayout>
            <Message curRes={baseLogin?.permissions} msgType={'1'} />
          </HeaderLayout>
        )}

        {/* 工作台 */}
        {/* {permissions && permissions?.['/workmanage/workbench'] && (
          <HeaderLayout>
            <Workbench />
          </HeaderLayout>
        )} */}
      </div>
    </GlobalHeaderContext.Provider>
  );
};

export default connect(({ baseLogin, navTab }: Record<string, any>) => ({
  permissions: baseLogin?.permissions,
  baseLogin: baseLogin,
  navTab,
}))(index);
